<?php

namespace App\Services\GoldStormSupport;

use App\Models\User;

class GoldStormSupport
{
	protected User $child;

	public function __construct(User $child)
	{
		$this->child = $child;
	}

	protected function transfer()
	{
		$beans = big_decimal(cs('storm')->gold_support_beans);
        if ($beans->isLessThanOrEqualTo(0)) return;
		account_beans($this->child)->plusSupportedGoldBeans($beans);

		$coins = big_decimal(cs('storm')->gold_support_coins);
		if ($coins->isLessThanOrEqualTo(0)) return;
        account_coins($this->child)->plusSupportedCoins($coins);

        $cashes = big_decimal(cs('storm')->gold_support_cashes);
        if ($cashes->isLessThanOrEqualTo(0)) return;
        account_cashes($this->child)->plusSupportedCashes($cashes);
	}

	public function support()
	{
		$this->transfer();
	}
}
